<template>
  <div class="table-case">
    <!-- <MyTag v-model="tag1"></MyTag>
    <MyTag v-model="tag2"></MyTag> -->
    <MyTable :data="goods">
      <template #header>
       <th>编号</th>
        <th>名称</th>
        <th>图片</th>
        <th width="100px">标签</th>
        </template>
        <template #body="{item,index}">
          <td>{{index+1}}</td>
        <td>{{item.name}}</td>
        <td>
          <img :src= "item.picture"/>
        </td>
        <td>
          <MyTag v-model= "item.tag"></MyTag>
        </td>
          </template>
    </MyTable>

    <MyTable :data="goods2">
      <template #header>
       <th>编号</th>
        <th>名称</th>
      
        <th width="100px">标签</th>
        </template>
        <template #body="{item,index}">
          <td>{{index+1}}</td>
        <td>{{item.name}}</td>
        <td>
          <MyTag v-model= "item.tag"></MyTag>
        </td>
          </template>
    </MyTable>
  </div>
</template>

<script>
import MyTag from './components/MyTag.vue'
import MyTable from './components/MyTable.vue'
export default {
  name: 'TableCase',
  components: {
    MyTag,
    MyTable
  },
  data () {
    return {
      tag1:'王乐乐',
      tag2:'书本海',
      goods: [
        { id: 101, picture: 'https://yanxuan-item.nosdn.127.net/f8c37ffa41ab1eb84bff499e1f6acfc7.jpg', name: '王乐乐', tag: '钓鱼王' },
        { id: 102, picture: 'https://yanxuan-item.nosdn.127.net/221317c85274a188174352474b859d7b.jpg', name: '强神', tag: '蝗虫王' },
        { id: 103, picture: 'https://yanxuan-item.nosdn.127.net/cd4b840751ef4f7505c85004f0bebcb5.png', name: '书本海', tag: '铁jio王' },
        { id: 104, picture: 'https://yanxuan-item.nosdn.127.net/56eb25a38d7a630e76a608a9360eec6b.jpg', name: '陈什么', tag: '回家王' },
      ],
      goods2: [
        { id: 101, picture: 'https://yanxuan-item.nosdn.127.net/f8c37ffa41ab1eb84bff499e1f6acfc7.jpg', name: '茉莉奶绿', tag: '奶茶' },
        { id: 102, picture: 'https://yanxuan-item.nosdn.127.net/221317c85274a188174352474b859d7b.jpg', name: '蚂蚱', tag: '可食用蝗虫' },
        { id: 103, picture: 'https://yanxuan-item.nosdn.127.net/cd4b840751ef4f7505c85004f0bebcb5.png', name: '门口的鸡柳', tag: '沙尘暴' },
        { id: 104, picture: 'https://yanxuan-item.nosdn.127.net/56eb25a38d7a630e76a608a9360eec6b.jpg', name: '下雨', tag: '不打伞' },
      ]
    }
  }
}
</script>

<style lang="less" scoped>
.table-case {
  width: 1000px;
  margin: 50px auto;
  img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    vertical-align: middle;
  }
}

</style>